import api from '@/utils/request'

// 可视化相关接口类型定义
export interface KeywordStatisticsRequest {
  startDate?: string
  endDate?: string
  category?: string
  limit?: number
}

export interface KeywordStatisticsResponse {
  items: KeywordStatItem[]
  total: number
}

export interface KeywordStatItem {
  keyword: string
  count: number
  weight: number
  category: string
}

export interface LiteratureTrendRequest {
  startDate?: string
  endDate?: string
  granularity?: string
  category?: string
}

export interface LiteratureTrendResponse {
  items: TrendItem[]
  total: number
}

export interface TrendItem {
  timePoint: string
  count: number
  keywords: string[]
}

// 可视化API
export const visualizationApi = {
  // 获取关键词统计信息
  getKeywordStatistics(data: KeywordStatisticsRequest): Promise<KeywordStatisticsResponse> {
    return api.post('/visualization-service/visualization/keyword-statistics', data)
  },

  // 获取文献趋势数据
  getLiteratureTrend(data: LiteratureTrendRequest): Promise<LiteratureTrendResponse> {
    return api.post('/visualization-service/visualization/literature-trend', data)
  }
}